package cn.edu.zafu.bigdata.x.hjn;

import java.util.HashMap;

public class StudentGradeManager {
    private HashMap<String, Integer> studentGrades;

    public StudentGradeManager() {
        studentGrades = new HashMap<>();
    }

    // 添加学生成绩
    public void addStudent(String name, int grade) {
        studentGrades.put(name, grade);
    }

    // 根据学生姓名获取成绩
    public int getGrade(String name) {
        return studentGrades.getOrDefault(name, -1); // 如果不存在，返回-1
    }

    // 删除学生成绩
    public void removeStudent(String name) {
        studentGrades.remove(name);
    }
}

